<template>
  <view>
    <page-head :title="title"></page-head>
    <view class="uni-padding-wrap">
	  <button @click="getPostion">获取当前位置</button>
	  <button @click="choosePostion">选择位置</button>
      
    </view>
  </view>
</template>

<script>
	
	  export default {
	    data () {
	      return {
	        title: 'chooseLocation',
	        hasLocation: false,
	        location: {},
	        locationAddress: ''
	      }
	    },
	    methods: {
	    
		  getPostion (){
			uni.getLocation({
				type: 'wgs84',
				success: function(res) {
					console.log(res);
				},
				fail: function(error) {
					console.error('获取位置失败：', error);
				}
			});
	
		  },
		  choosePostion() {
			  uni.chooseLocation({
			  	success: res => {
			  		console.log(7788, res);
			  		console.log('位置名称：' + res.name);
			  		console.log('详细地址：' + res.address);
			  		console.log('纬度：' + res.latitude);
			  		console.log('经度：' + res.longitude);
			  	}
			  });
		  }
		  
	    }
	  }

	
</script>
<style>
  .page-body-info {
    padding-bottom: 0;
    height: 440rpx;
  }

  .tips {
    font-size: 12px;
    margin-top: 15px;
    opacity: .8;
  }
</style>
